package com.zhonghui.modlules.shop.eshopService.Ipml;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.eshop.service.Impl.BaseServiceImpl;
import com.zhonghui.common.eshopMapper.SystemAttachmentMapper;
import com.zhonghui.modlules.shop.eshopDomain.SystemAttachment;
import com.zhonghui.modlules.shop.eshopService.SystemAttachmentService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(
        rollbackFor = {Exception.class}
)
public class SystemAttachmentServiceImpl extends BaseServiceImpl<SystemAttachmentMapper, SystemAttachment> implements SystemAttachmentService {

    private SystemAttachmentMapper systemAttachmentMapper;

    public SystemAttachment getByCode(String code) {
        LambdaQueryWrapper<SystemAttachment> wrapper = new LambdaQueryWrapper();
        ((LambdaQueryWrapper)wrapper.eq(SystemAttachment::getInviteCode, code)).last("limit 1");
        return (SystemAttachment)this.systemAttachmentMapper.selectOne(wrapper);
    }
}
